﻿/// <reference path="../../../extjs/ext-all-debug.js" />
Ext.define('yzmh.view.collect.Jmydm', {
    extend: 'Ext.Panel',
    alias: 'widget.jmydm',
    closable: true,
    title: '',
    layout: 'border',
    requires: ['yzmh.view.CheckCode'],
    tbar: [{
        xtype: 'checkcode',
        cls: 'key',
        fieldLabel: '验证码',
        name: 'CheckCode',
        allowBlank: false,
        isLoader: true,
        blankText: '验证码不能为空',
        codeUrl: 'data/collect/jmydm.aspx?a=validate&r=' + Math.random(),
        width: 100,
        labelWidth: 50
    }, { xtype: 'tbtext' }, "-", {
            xtype: 'combo',
            name: 'type',
            fieldLabel: '筛选',
            typeAhead: true,
            displayField: 'name',
            valueField: 'value',
            store: Ext.create("Ext.data.ArrayStore", {
                fields: ['name',"value"],
                data: [
                    ['全部', "ComicList"], ['连载', 'ManhuaLianzai'], ['完结', 'ManhuaWanjie'],
                    ['内地', "ManhuaDiqu-china"], ['香港', 'ManhuaDiqu-hongkong'], ['台湾', 'ManhuaDiqu-taiwan'], ['韩国', 'ManhuaDiqu-korea'], ['欧美', 'ManhuaDiqu-europeamericas'], ['日本', 'ManhuaDiqu-japan'], ['其他', 'ManhuaDiqu-Qita']
                ]
            }),
            labelWidth: 30,
            labelAlign: 'right',
            width: 120,
            forceSelection: true,
            editable: false,
            queryMode: 'local'
    }, "-", { xtype: 'tbfill' }, { action: 'checkComic', text: '检测漫画', icon: 'extjs/icons/book_link.png' }, "-", { action: 'importComic', text: '导入漫画', icon: 'extjs/icons/book_add.png' }, "-", { action: 'importChapter', text: '导入章节', icon: 'extjs/icons/page_add.png' }
    ],
    items: [{
        xtype: 'grid',
        store: 'collect.Jmydm',
        loadMask: true,
        columnLines: true,
        forceFit: true,
        region: 'center',
        sortableColumns: false,
        viewConfig: {
            trackOver: false,
            stripeRows: true
        },
        selType: 'rowmodel',
        selModel: Ext.create("Ext.selection.RowModel", {
            mode: 'SINGLE'
        }),
        columns: [{
                xtype: 'rownumberer',
                align: 'center'
            },
            { header: '漫画名称', dataIndex: 'mhmc' },
            { header: '漫画名称', dataIndex: 'zjmc', width: 25 },
            { header: '作者', dataIndex: 'zzmc', width: 25 },
            {
                header: '漫画地址', dataIndex: 'mhurl', width: 100
            },
            {
                action: 'view',
                xtype: 'actioncolumn',
                width: 20,
                header: '预览',
                align: 'center',
                icon: 'extjs/icons/page_link.png'
            },
            {
                header: '存在',
                width: 20,
                align: 'center',
                dataIndex: 'exist',
                xtype: 'booleancolumn',
                trueText: '是',
                falseText: '否'
            }
        ],
        bbar: {
            xtype: 'pagingtoolbar',
            store: 'collect.Jmydm',
            displayInfo: true,
            displayMsg: '显示数据 {0} - {1} of {2}',
            emptyMsg: "没有查询到数据"
        }
    }, {
        xtype: 'panel',
        layout: 'vbox',
        region: 'east',
        border: false,
        hidden:true,
        items: [{
            xtype: 'propertygrid',
            width: 300,
            source: { }
        }, {
            name: 'chaptergrid',
            xtype: 'grid',
            width: 300,
            flex: 1,
            columnLines: true,
            forceFit: true,
            store: {
                stype: 'store',
                model: 'yzmh.model.Chapter',
                groupField: 'type'
            },
            selType: 'rowmodel',
            selModel: Ext.create("Ext.selection.RowModel", {
                mode: 'MULTI'
            }),
            features: [Ext.create('Ext.grid.feature.Grouping', {
                groupHeaderTpl: '{name} ({rows.length} 条记录)',
                hideGroupedHeader: true,
                startCollapsed: false
            })],
            columns: [
                { header: '名称', dataIndex: 'zjmc', width: 50 },
                {
                    header: '地址', dataIndex: 'zjurl'
                }]
            }]
        }]
});

